package polymorphism;

class Super {
    public int field = 0;

    public int getField() {
        return field;
    }

    public void Say() {
        System.out.println("Super Ha ha");
    }
}

class Sub extends Super {
    public int field = 1;

    @Override
    public int getField() {
        return field;
    }


    public int getSuperField() {
        return super.field;
    }

    @Override
    public void Say() {
        System.out.println("Sub Ha ha");
    }

}

public class FieldAccess {
    public static void main(String[] args) {
        Super sup = new Sub(); // Upcast
        System.out.println("sup.field = " + sup.field +
                ", sup.getField() = " + sup.getField());
        sup.Say();
        Sub sub = new Sub();
        System.out.println("sub.field = " + sub.field +
                ", sub.getField() = " + sub.getField()
                + ", sub.getSuperField() = " + sub.getSuperField());
    }
}